package com.gitee.feizns.itrip.personal.biz.service;

import com.gitee.feizns.itrip.personal.beans.vo.Page;
import com.gitee.feizns.itrip.personal.biz.entity.ao.ForAcceptAddHotelOrder;
import com.gitee.feizns.itrip.personal.biz.entity.ao.ForAcceptGetPersonalOrderList;
import com.gitee.feizns.itrip.personal.biz.entity.ao.ForAcceptPreOrderInfo;
import com.gitee.feizns.itrip.personal.biz.entity.vo.ForViewAddHotelOrder;
import com.gitee.feizns.itrip.personal.biz.entity.vo.ForViewGetPersonalOrderInfo;
import com.gitee.feizns.itrip.personal.biz.entity.vo.ForViewGetPersonalOrderRoomInfo;
import com.gitee.feizns.itrip.personal.biz.entity.vo.ForViewPersonalOrderList;
import com.gitee.feizns.itrip.personal.biz.entity.vo.ForViewPreOrderInfo;
import com.gitee.feizns.itrip.personal.biz.entity.vo.ForViewQueryOrderById;
import lombok.NonNull;

import java.util.Date;

/**
 * @author feizns
 * @since 2019/1/10 0010
 */
public interface HotelOrderService {

    /**
     * 两小时内未操作将过期
     */
    int TWO_HOURS = 2;

    /**
     * 获取指定用户的订单列表
     * @param condition
     * @return
     */
    Page<ForViewPersonalOrderList> getPersonalOrderList(ForAcceptGetPersonalOrderList condition, Long curtUserId);

    /**
     * 根据订单编号获取订单房间信息
     * @param orderId
     * @return
     */
    ForViewGetPersonalOrderRoomInfo getPersonalOrderRoomInfo(Long orderId);

    /**
     * 根据订单编号获取个人订单信息
     * @param orderId
     * @return
     */
    ForViewGetPersonalOrderInfo getPersonalOrderInfo(Long orderId);

    /**
     * 查询指定区域内剩余的房间数量
     * @param info 查询条件
     * @return
     */
    ForViewPreOrderInfo getPreOrderInfo(ForAcceptPreOrderInfo info);

    /**
     * 根据编号获取指定的订单
     * @param orderId
     * @return
     */
    ForViewQueryOrderById getOrderById(Long orderId);

    /**
     * 添加生成订单
     * @param order
     * @return
     */
    ForViewAddHotelOrder addHotelOrder(ForAcceptAddHotelOrder order, Long curtUserId);

    /**
     * 定时刷新订单状态 将2小时内未付款的订单释放
     */
    void flushOrder();

    /**
     * 查询指定房间在指定时间内的库存量
     * @param roomId
     * @param startDate
     * @param endDate
     * @return 剩余库存量
     */
    int getStore(@NonNull Long roomId, @NonNull Date startDate, @NonNull Date endDate);

}

